package com.spider.gk.common;

import java.util.HashMap;
import java.util.Map;

public class CopyOfCopyOfContentAbstractForWant {

	private String content;
	
	public CopyOfCopyOfContentAbstractForWant(String content){
		this.content = content;
	}
	
	public Map<String,String> process(){
		
		if(this.content!=null && this.content.length()>0){
			
			Map<String,String> result = new HashMap<String,String>();
			
			int priceIdIndex = content.lastIndexOf("\"J_StrPrice\" >");
			
			int priceIdIndexEnd = content.indexOf("<", priceIdIndex);
			try{
			if(priceIdIndex>0 && priceIdIndexEnd>0){
				String priceString = content.substring(priceIdIndex+14, priceIdIndexEnd);

				Double doubleNum = Double.parseDouble(priceString);
				if(doubleNum>80 && doubleNum<=100){
					result.put("price",priceString);
					int titleIdIndex = content.lastIndexOf("\"tb-detail-hd\">");
					
					int titleIdIndexEnd = content.indexOf("</h3>", titleIdIndex);
					
					if(titleIdIndex>0 && titleIdIndexEnd>0){
						String titleString = content.substring(titleIdIndex+20, titleIdIndexEnd);
						result.put("title",titleString);
						System.out.println(content.substring(titleIdIndex+20, titleIdIndexEnd));
					}
				}
				System.out.println(content.substring(priceIdIndex+14, priceIdIndexEnd));
			}
			}
			catch(Exception e){
				
			}

			
			return result;
			
		}
		
		return new HashMap<String ,String>();
	}
	
}
